package com.zyz.G_常用类.时间类;

import java.util.Calendar;

/**
 * @author: vick
 * @Date: 2025/3/19
 * @Description:
 * @version: 1.0
 */
public class Demo2 {
    public static void main(String[] args) {
        //Calendar 是抽象类，不能创建对象
        //默认使用公历
        Calendar calendar = Calendar.getInstance();
        System.out.println(calendar);
        //公元前0  公园后1
        System.out.println(calendar.get(Calendar.ERA));
        System.out.println(calendar.get(Calendar.YEAR));
        //月份从0开是
        System.out.println(calendar.get(Calendar.MONTH));
        //日期
        System.out.println(calendar.get(Calendar.DATE));
        //当前日期在这一年中的第几天
        System.out.println(calendar.get(Calendar.DAY_OF_YEAR));
        //一个月的第几天
        System.out.println(calendar.get(Calendar.DAY_OF_MONTH));
        //一周的第几天
        System.out.println(calendar.get(Calendar.DAY_OF_WEEK));

        //本月最大是几号
        System.out.println(calendar.getActualMaximum(Calendar.DATE));
        System.out.println(calendar.getActualMinimum(Calendar.DATE));

        //指定 日期
        calendar.set(Calendar.YEAR, 2024);
        calendar.set(Calendar.MONTH, 3);
        calendar.set(Calendar.DATE, 14);

        System.out.println(calendar);

    }
}
